package com.dongdongshop.controller;

import com.dongdongshop.pojo.TbUser;
import org.apache.shiro.SecurityUtils;
import org.apache.shiro.subject.Subject;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.RequestMapping;

@Controller
@RequestMapping("registerController")
public class RegisterController {

    //注册
    @RequestMapping("toRegister")
    public String toRegister(){
        return "/register";
    }

    //登录
    @RequestMapping("toLogin")
    public String toLogin(){
        return "/login";
    }

    //登录成功跳转
    @RequestMapping("list")
    public String listGet(Model model){
        Subject subject = SecurityUtils.getSubject();
        TbUser tbUser = (TbUser)subject.getPrincipal();
        model.addAttribute("tbUser",tbUser);
        return "index";
       /* return "/TbUser/list";*/
    }
}
